package com.qf.config;

import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.qf.intercetor.DynamicDataSource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 你的名字
 * @Date: 2021/07/22/19:01
 * @Description:
 */
@Configuration
@Slf4j
public class webMvcConfig implements WebMvcConfigurer {
   @Autowired
    private DynamicDataSource dynamicDataSource;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry
                .addInterceptor(dynamicDataSource)
                .addPathPatterns("/**");
    }
}
